Skip to content

Add zend_getpagesize() and reuse it in accelerator and fiber #7057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2021

Conversation

twose
Copy link
Member

@twose twose commented May 27, 2021

The code is referenced from https://github.com/jemalloc/jemalloc/blob/master/src/pages.c#L417 .
A small change, just for code reuse.

GetSystemInfo(&system_info);
page_size = system_info.dwPageSize;
# else
page_size = getpagesize();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're unconditionally using getpagesize() here. Why does the new code limit its use to only FreeBSD?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux manual recommends using sysconf(_SC_PAGESIZE) instead of getpagesize() for portability.
The code is referenced from https://github.com/jemalloc/jemalloc/blob/master/src/pages.c#L417
The comment shows the reason for it, it can avoid a useless syscall on FreeBSD.

@twose twose merged commit 795efd7 into php:master May 27, 2021
@twose twose deleted the fiber-getpagesize branch May 27, 2021 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants